
package cn.yunyichina.provider.clinic.thread;

import java.lang.reflect.Method;
import java.util.concurrent.Callable;

import org.slf4j.LoggerFactory;

import cn.yunyichina.provider.framework.data.AppConfig;
import cn.yunyichina.provider.framework.data.SpringContextHandler;


public class QueryHashTableCallable implements Callable<Object> {
	private static org.slf4j.Logger logger = LoggerFactory.getLogger(QueryHashTableCallable.class);

	
	private Class<?> springBeanClazz;

	
	private String methodName;

	
	private Object[] parameters;

	
	private Class<?>[] parameterTypes;

	public QueryHashTableCallable(Class<?> springBeanClazz, String methodName, Object[] parameters, Class<?>[] parameterTypes) {
		super();
		this.springBeanClazz = springBeanClazz;
		this.methodName = methodName;
		this.parameters = parameters;
		this.parameterTypes = parameterTypes;
	}

	
	@Override
	public Object call() throws Exception {
		
		Object springBean = SpringContextHandler.getBean(springBeanClazz);
		Method method = springBeanClazz.getMethod(methodName, parameterTypes);
		return method.invoke(springBean, parameters);
	}

	public String getMethodName() {
		return methodName;
	}

	public void setMethodName(String methodName) {
		this.methodName = methodName;
	}

	public Object[] getParameters() {
		return parameters;
	}

	public void setParameters(Object[] parameters) {
		this.parameters = parameters;
	}

	public Class<?>[] getParameterTypes() {
		return parameterTypes;
	}

	public void setParameterTypes(Class<?>[] parameterTypes) {
		this.parameterTypes = parameterTypes;
	}

	public Class<?> getSpringBeanClazz() {
		return springBeanClazz;
	}

	public void setSpringBeanClazz(Class<?> springBeanClazz) {
		this.springBeanClazz = springBeanClazz;
	}
}
